package com.itheima.Test5;
/*
结合继承的思想，分析下列需求并实现
定义项目经理类Manager 【属性：姓名 工号 工资 奖金】【行为：工作work】
定义程序员类Coder【属性：姓名 工号 工资】【行为：工作work】
要求：通过有参构造创建两个类的对象，并调用各自的work方法
运行结果：
姓名为:张三,工号为:9527,工资为:10000.0,的程序员正在编写代码
姓名为:李四,工号为:9528,工资为:15000.0,奖金为:2000.0,的项目经理正在管理程序员写代码
 */
class Coder extends Person {
    public Coder(String name,int id,double salary) {
        super("张三",9527,10000.0);
    }
    public void work(){
        System.out.println("姓名为:" + getName() + "," + "工号为:" + getId() + "," + "工资为:" + getSalary() + "," + "的程序员正在编写代码");
    }
}
class Manager extends Person{
    private  double prize;
    public Manager(String name, int id, double salary, double prize) {
        super("李四", 9528, 15000.0);
        this.prize = prize;
    }
    public double getPrize() {
        return prize;
    }
    public void setPrize(int prize) {
        this.prize = prize;
    }
    public void work(){
        System.out.println("姓名为:" + getName() + "," + "工号为:" + getId() + "," + "工资为:" + getSalary() + "," + "奖金为:" + getPrize() +"," +"的项目经理正在管理程序员写代码");
    }
}
class Person{
    private String name;
    private int id;
    private double salary;
    public Person(String name, int id, double salary) {
        this.name = name;
        this.id = id;
        this.salary = salary;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public double getSalary() {
        return salary;
    }
    public void setSalary(double salary) {
        this.salary = salary;
    }
}
public class Demo5 {
    public static void main(String[] args) {
        Coder coder = new Coder("张三",9527,10000.0);
        coder.work();
        Manager manager = new Manager("李四",9528,15000.0,2000.0);
        manager.work();
    }
}
